package com.itxx.anonymousAndLambda.test3;
//接口抽象方法   有 String 类型的参数  没有返回值

public interface EatAble {
    void eat(String food);
}

class   EatImpl implements  EatAble{
    @Override
    public void eat(String food) {
        System.out.println("今天吃了"+food);
    }
}
class Test1{
    public static void main(String[] args) {
        //接口实现类
        EatImpl e = new EatImpl();
        e.eat("(接口实现类)面条");
        //匿名内部类
        useEatAble(new EatAble() {
            @Override
            public void eat(String food) {
                System.out.println("(匿名内部类)吃了"+food);
            }
        });
        //lambda表达式
        useEatAble((String food)->{
            System.out.println("(lambda表达式)今天吃"+food);
        });
    }



    public static void useEatAble(EatAble eatTest) {
        eatTest.eat("炒面");
    }
}